//
// Created by user on 2022/3/28.
//

#include "content.h"

using namespace std;

#define int long long
#define endl '\n'

#define LOW_BIT(x) (x & (-x))

#define MOD 998244353
#define N 100000

int n, m;
int w[N];

struct node {
    int num, l, r, ok, lazy;
} tr[4 * N];

int lowbit(int x) {
    return x & (-x);
}

void pushup(int u) {
    tr[u].num = (tr[u << 1].num + tr[u << 1 | 1].num) % MOD;
    if (tr[u << 1].ok && tr[u << 1 | 1].ok)
        tr[u].ok = 1;
}

void pushdown(int u) {
    if (tr[u].lazy <= 1)
        return;
    tr[u << 1].num = tr[u << 1].num * tr[u].lazy % MOD;
    tr[u << 1 | 1].num = tr[u << 1 | 1].num * tr[u].lazy % MOD;
    tr[u << 1].lazy = tr[u << 1].lazy * tr[u].lazy % MOD;
    tr[u << 1 | 1].lazy = tr[u << 1 | 1].lazy * tr[u].lazy % MOD;
    tr[u].lazy = 1;
}

void build(int u, int l, int r) {
    tr[u] = {w[l], l, r, 0, 1};
    if (l == r) {
        if (tr[u].num == lowbit(tr[u].num))
            tr[u].ok = 1;
        return;
    }
    int mid = l + r >> 1;
    build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);
    pushup(u);
    return;
}

int _query(int u, int l, int r) {
    //cout << u << " " << l << " " << r << endl;
    if (tr[u].l >= l && tr[u].r <= r) {
        return tr[u].num % MOD;
    }
    pushdown(u);
    int mid = tr[u].l + tr[u].r >> 1;
    int res = 0;
    if (l <= mid)
        res += _query(u << 1, l, r) % MOD;
    if (r > mid)
        res = (res + _query(u << 1 | 1, l, r)) % MOD;
    return res;
}

void modify(int u, int l, int r) {
    //cout << u << " " << l << " " << r << endl;
    if (tr[u].l >= l && tr[u].r <= r && tr[u].ok) {
        tr[u].num = (tr[u].num * 2) % MOD;
        tr[u].lazy = (tr[u].lazy * 2) % MOD;
        return;
    }
    if (tr[u].l == tr[u].r && tr[u].l >= l && tr[u].r <= r) {
        tr[u].num += lowbit(tr[u].num);
        if (tr[u].num == lowbit(tr[u].num)) {
            tr[u].ok = 1;
            tr[u].num %= MOD;
        }
        return;
    }
    pushdown(u);
    int mid = tr[u].l + tr[u].r >> 1;
    if (mid >= l) {
        modify(u << 1, l, r);
    }
    if (mid < r) {
        modify(u << 1 | 1, l, r);
    }
    pushup(u);

}

void prin() {
    for (int i = 1; i <= n; i++) {
        cout << _query(1, i, i) << " ";
    }
    cout << endl;
}

void standard() {
    int t;

    cin >> t;
    while (t--) {
        cin >> n;
        for (int i = 1; i <= n; i++)
            cin >> w[i];
        build(1, 1, n);
        cin >> m;
        while (m--) {
            int a, b, c;
            cin >> a >> b >> c;
            //prin();
            if (a == 1) {
                modify(1, b, c);
            } else {
                cout << _query(1, b, c) << endl;
            }
        }
    }
}